#include <stdio.h>

int main ()
{
	double x, a, result = 0;
	short i = 0;

	scanf("%lf", &x);
	while (scanf("%lf", &a) == 1) {
		if (i > 0)
			result *= x;
		result += a;
		i++;
	}

	printf("%lf\n", result);
	return 0;
}
